package me.magicall.test;

import java.net.URLDecoder;
import java.net.URLEncoder;

import me.magicall.consts.StrConst.EncodingConst;

public class Usefull {

	public static void main(final String[] args) throws Exception {
//		asciiChars();
//		encode("");
		decode("ftp://222.171.15.68:44588/%E6%9C%80%E6%96%B0%E7%94%B5%E5%BD%B1/%E6%AC%A7%E7%BE%8E%E4%B8%93%E5%8C%BA/01.25%E7%94%9F%E5%8C%96%E5%A4%A7%E8%9C%98%E8%9B%9B/02.rmvb");
	}

	static void decode(final String s) throws Exception {
		System.out.println(URLDecoder.decode(s, EncodingConst.UTF8));
	}

	static void encode(final String s) throws Exception {
		System.out.println(URLEncoder.encode(s, EncodingConst.UTF8));
	}

	static void asciiChars() {
		for (int i = 0; i < 256; ++i) {
			System.out.print((i < 100 ? (i < 10 ? "00" : "0") : "") + i);
			System.out.print("【" + (i < 16 ? "0" : "") + Integer.toHexString(i) + "】");
			System.out.println("【 " + (char) i);
		}
	}
}
